
import java.io.File;
import java.util.*;


public class tester {

        /**
         * @param args
         * @throws Exception 
         * @throws NumberFormatException 
         */
        public static void main(String[] args) throws NumberFormatException, Exception {
        	
        	//Bipartite graph testing
            
            SimpleGraph G;
            G = new SimpleGraph();
           /* GraphInput.LoadSimpleGraph(G, "/Users/ramyasaripella/Documents/workspace/advalgo/myinput.txt");
            Edge e;
            for(Iterator<Edge> i = G.edges(); i.hasNext(); ) {
                    e = i.next();
                            e.setData(new EdgeData((int) Double.parseDouble(e.getData().toString()), 0));
            }
            Vertex v, s = null, t = null;
            for(Iterator<Vertex> i = G.vertices(); i.hasNext(); ) {
                    v = i.next();
                    v.setData(new VertexData());
                    String name = v.getName().toString();
                    if(name.equals("s"))
                            s = v;
                    else if(name.equals("t"))
                            t = v;
            }
            if(s != null && t != null) {
            	int flow=FordFulkerson.maxFlow(G, s, t);
            	System.out.println("Bipartitie Graph using FF"+flow+ " in " + (System.currentTimeMillis()) + "ms");
            }*/
            
            //Random graph
            RandomG.generate(100, 30, 1, 2, "newgraph");
            GraphInput.LoadSimpleGraph(G, "/Users/ramyasaripella/Documents/workspace/advalgo/newgraph");
            Edge e;
            for(Iterator<Edge> i = G.edges(); i.hasNext(); ) {
                    e = i.next();
                            e.setData(new EdgeData((int) Double.parseDouble(e.getData().toString()), 0));
            }
            Vertex v, s = null, t = null;
            for(Iterator<Vertex> i = G.vertices(); i.hasNext(); ) {
                    v = i.next();
                    v.setData(new VertexData());
                    String name = v.getName().toString();
                    if(name.equals("s"))
                            s = v;
                    else if(name.equals("t"))
                            t = v;
            }
            if(s != null && t != null) {
            	int flow=FordFulkerson.maxFlow(G, s, t);
            	System.out.println("Random Graph using FF max flow is "+flow+ " in " + (System.currentTimeMillis()) + "ms");
            }
            
            
           
                //System.out.println(graph.RandomG.generate(100, 1000, 10, 100, 0));
        }
}